fix: Project deletion failing with permalink normalization#345
Merged
phernandez merged 1 commit intomainfrom Oct 10, 2025
Merged
fix: Project deletion failing with permalink normalization#345phernandez merged 1 commit intomainfrom
phernandez merged 1 commit intomainfrom
Conversation
The remove_project() method was using the input name parameter to delete from config.projects instead of the project_name returned by get_project(). This caused failures when the input name didn't exactly match the config dictionary key, even though get_project() successfully found the project via permalink matching. Now uses the actual project_name returned by get_project() to ensure we're deleting the correct dictionary key. Added 5 comprehensive tests that validate the fix: - test_remove_project_with_exact_name_match - test_remove_project_with_permalink_lookup - test_remove_project_uses_canonical_name - test_remove_project_nonexistent_project - test_remove_project_cannot_remove_default These tests mirror the existing set_default_project tests and ensure permalink normalization works correctly for project deletion. Fixes: Project deletion failing with "not found" error despite project existing
jope-bm
approved these changes
Oct 10, 2025
phernandez
approved these changes
Oct 10, 2025
This was referenced Oct 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug in
ConfigManager.remove_project()where project deletion would fail with "not found" error even when the project clearly existed and was returned bylist_memory_projects.Root Cause
The
remove_project()method was using the inputnameparameter to delete fromconfig.projectsinstead of theproject_namereturned byget_project(). Sinceget_project()uses permalink-based lookup, it can find projects even when the input name doesn't exactly match the dictionary key. This mismatch caused the deletion to fail.The Fix
Changed line 313 in
src/basic_memory/config.pyto use the canonicalproject_namereturned byget_project():Test Coverage
Added 5 comprehensive tests that validate the fix:
test_remove_project_with_exact_name_match- Basic deletion with exact key matchtest_remove_project_with_permalink_lookup- Deletion with permalink normalizationtest_remove_project_uses_canonical_name- Verifies canonical key is usedtest_remove_project_nonexistent_project- Error handling for missing projectstest_remove_project_cannot_remove_default- Protection of default projectAll tests pass and follow the same pattern as the existing
set_default_projecttests.Impact
This fix ensures that MCP project deletion works correctly via
delete_project()tool, matching the behavior ofset_default_project()which already correctly uses the canonical project name.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com